//
//  InvoicesViewController.m
//  KurtulusLaw
//
//  Created by phuc phuc on 12/1/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "InvoicesViewController.h"
#import "InvoicesCell.h"
#import "KInvoiceDAO.h"
#import "KResponedInvoiceCommandDTO.h"
#import "kInvoiceCommandDTO.h"
#import "KInvoiceCellFactory.h"
@interface InvoicesViewController()
@end

@implementation InvoicesViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle



- (void)viewDidLoad
{
    [super viewDidLoad];
   
    [self.titleView setText:NSLocalizedString(@"Invoices", nil)];
}

- (void)initializeFactory {
	_searchFileDAO = [[KInvoiceDAO alloc] init];
	_searchCommandDTO = [[kInvoiceCommandDTO alloc] initWithSessionID:[CCommon shareSessionID] ];
	_cellFactory = [[KInvoiceCellFactory alloc] init];
	
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
	UIView *view = [super tableView:tableView viewForHeaderInSection:section];
	// Create label with section title
    UILabel *label = [[UILabel alloc] init] ;
    label.frame = CGRectMake(40, 0, 160, 23);
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont boldSystemFontOfSize:15.0f];
    label.text = NSLocalizedString(@"Invoice", nil);
    label.backgroundColor = [UIColor clearColor];
    [view addSubview:label];
	
	UILabel *label1 = [[UILabel alloc] init] ;
    label1.frame = CGRectMake(210, 0, 130, 23);
    label1.textColor = [UIColor whiteColor];
    label1.font = [UIFont boldSystemFontOfSize:15.0f];
    label1.text = NSLocalizedString(@"Document", nil);
    label1.backgroundColor = [UIColor clearColor];
	[view addSubview:label1];

    return view;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}


- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


@end
